using UnityEngine;
using UnityEngine.UI;

public class ImageTwinkle : MonoBehaviour
{
	private Image m_Image;

	private Image m_PointerImage1;

	private Image m_PointerImage2;

	private Color c1;

	private Color c2;

	private float m_Time;

	private float m_T;

	private float m_percentage;

	private bool m_Inverse;

	public void SetColor(Color _c1, Color _c2)
	{
		c1 = _c1;
		c2 = _c2;
	}

	public void SetTarget(Image i)
	{
		m_Image = i;
	}

	public void SetTime(float _time)
	{
		m_Time = _time;
	}

	public void SetImage(Image image, Image pImage1, Image pImage2)
	{
		m_Image = image;
		m_PointerImage1 = pImage1;
		m_PointerImage2 = pImage2;
	}

	private void Start()
	{
		m_T = 0f;
		m_Image = GetComponent<Image>();
		m_PointerImage1 = base.transform.GetChild(0).GetComponent<Image>();
		m_PointerImage2 = base.transform.GetChild(1).GetComponent<Image>();
	}

	private void Update()
	{
		m_percentage = m_T / m_Time;
		if (!m_Inverse)
		{
			m_Image.color = Color.Lerp(c1, c2, m_percentage);
		}
		else
		{
			m_Image.color = Color.Lerp(c2, c1, m_percentage);
		}
		m_PointerImage1.color = m_Image.color;
		m_PointerImage2.color = m_Image.color;
		m_T += Time.deltaTime;
		if (m_T >= m_Time)
		{
			m_T = 0f;
			m_Inverse = !m_Inverse;
		}
	}
}
